package com.originskyseed.platform.task.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.originskyseed.platform.task.model.Task;
import com.originskyseed.platform.task.model.TaskRankVO;
import com.originskyseed.platform.task.model.TaskVO;

/**
 * 任务表Mapper类（OSI_TASK）
 *
 * @author wlj
 */
public interface TaskMapper {

	/**
	 * 删除记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int updateByKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(Task record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(Task record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param recordVO
	 * @return
	 * @throws Exception
	 */
	public int insertSelectiveByTaskVO(TaskVO recordVO) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param recordVO
	 * @return
	 * @throws Exception
	 */
	public int updateByTaskVO(TaskVO recordVO) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(Task record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(Task record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param recordVO
	 * @return
	 * @throws Exception
	 */
	public int updateByTaskVOSelective(TaskVO recordVO) throws Exception;

	/**
	 * 定时更新状态（定时任务）
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int updateTaskStateByKey(String id) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Task selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public TaskVO selectByTaskVOPrimaryKey(String id) throws Exception;

	/**
	 * 查询任务详情
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Task selectByTaskid(String id) throws Exception;

	/**
	 * 查询我的今日任务
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int selectTodayTaskCount(Map<String, Object> map) throws Exception;

	/**
	 * 统计工会/家族的今日任务
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int tradeTodayTaskCount(Map<String, Object> map) throws Exception;

	/**
	 * 统计我/工会/家族的发布任务数量
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int tradePublishTaskCount(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_日数据
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> getTaskLineChar(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_日数据_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskFinishState(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_日数据_未完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskUnFinishState(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_日数据_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskOverState(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_周统计
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> getTaskLineWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_周_月统计_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskFinishStateWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_周_月统计_未完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskUnFinishStateWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_日统计_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptFinishState(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_日统计_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptOverState(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_周月统计_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptFinishStateWeekOrMonth(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_周月统计_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptOverStateWeekOrMonth(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_周_月统计_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskOverStateWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectList(Task record) throws Exception;

	/**
	 * 接单中心_分页查询列表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectListByPage(Map<String, Object> params) throws Exception;

	/**
	 * 我的任务列表_分页查询
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectCenterListByPage(Map<String, Object> params) throws Exception;

	/**
	 * 开放平台任务列表_分页查询
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectAdminListByPage(Map<String, Object> params) throws Exception;

	/**
	 * 排行榜
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<TaskRankVO> selectRankList(Map<String, Object> params) throws Exception;

	/**
	 * 我的排名
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public TaskRankVO selectmyRankList(Map<String, Object> params) throws Exception;

	/**
	 * 运管统计看板数据
	 *
	 * @return
	 * @throws Exception
	 */
	public int owTotalData(Map<String, Object> params) throws Exception;

	/**
	 * 工会业务员完成率统计
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Integer>> getTaskLineToSaler(Map<String, Object> map) throws Exception;

	/**
	 * 开放平台工会任务情况数据
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int countTradeUnionTaskByState(Map<String, Object> map) throws Exception;

	/**
	 * 新员工添加培训任务
	 *
	 * @param type
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectNewUserTrainTaskJobList(@Param("type") int type) throws Exception;

	/**
	 * 查询推广任务
	 *
	 * @param state
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectPromoteTaskJobList(@Param("state") int state) throws Exception;


	/**
	 * 查询推广任务是否存在
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public String selectMaintainTaskExist(Map<String,Object> map)throws Exception;
}
